package utils
{
	import flash.display.Graphics;
	import flash.display.LineScaleMode;

	public class ComponentUtils
	{
		public function ComponentUtils()
		{
		}
		
		public static function drawRectangle(pGraphics:Graphics, pX:int, pY:int, pWidth:uint, pHeight:uint, pColor:uint = 0, pGradient:GradientVO = null, pBorder:BorderVO = null, pCorner:CornerVO = null, pAlpha:Number = 1):void
		{
			if (pGradient)
			{
				pGraphics.beginGradientFill(pGradient.type, pGradient.colors, pGradient.alphas, pGradient.ratios, pGradient.matrix);
			} else {
				pGraphics.beginFill(pColor, pAlpha);
			}
			
			if (pBorder)
			{
				pGraphics.lineStyle(pBorder.tickness, pBorder.color, pBorder.alpha, false, LineScaleMode.NONE);
			}
			
			if (pCorner)
			{
				pGraphics.drawRoundRectComplex(pX, pY, pWidth, pHeight, pCorner.topLeft, pCorner.topRight, pCorner.bottomLeft, pCorner.bottomRight);
			} else {
				pGraphics.drawRect(pX, pY, pWidth, pHeight);	
			}
			
			pGraphics.endFill();
		}
	}
}